home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac: Not for Sale / Another.not.for.sale (Australia).iso / fade into you / being there / Issues & Ideas / Anonymous remailers / Remailers / morpheus-remailer-hack Folder / Request-Safe-Remailing-To.pl < prev   
Perl Script  |  1993-06-29  |  1KB  |  49 lines

  1. #!/usr/bin/perl
  2.  
  3. # Check the status of the next remailer in the chain 
  4. # obviously I'm not much of a perl hacker - morpheus@entropy.linet.org
  5.  
  6. $spooldir = "spool";
  7. $mid = $ENV{'MESSAGE_ID'};
  8.  
  9. @msg = <STDIN>;
  10.  
  11. open(SPOOL, ">$spooldir/$mid") || open (SPOOL, ">failed.$$") || die "Cannot open spool file." ;
  12.  
  13. while (@msg) {
  14.     $_ = shift(@msg);
  15.     s/^Request-Safe-Remailing-To:/Request-Remailing-To:/;
  16.     print SPOOL $_;
  17.     s/[ \t\r]*$// ;
  18.         last if /^$/ ;
  19.         if (/^Request-Remailing-To:/) {
  20.                 chop ;
  21.                 s/^.*:// ;
  22.                 $addressee = $_ ;
  23.         s/.*//;
  24.         }
  25. }
  26.  
  27. $retaddr = " " . $ENV{'LOGNAME'} . "@" . $ENV{'VISIBLE_NAME'};
  28.  
  29. #open( OUTPUT, ">foo" ) || die "Cannot open 'foo'." ;
  30. open( OUTPUT, "| /usr/lib/sendmail " . $addressee ) ;
  31. select( OUTPUT ) ;
  32.  
  33. print "To:" . $addressee . "\n" ;
  34. print "From:" . $retaddr . "\n" ;
  35. print "Remailer-Status-Check: " . $mid . "\n";
  36.  
  37. print "\n";
  38.  
  39. print "Remailer status requested by " . $ENV{'USERNAME'} . "\n\n";
  40.  
  41. close(OUTPUT);
  42.  
  43. print SPOOL "\n";
  44. while(@msg) {
  45. print SPOOL shift(@msg);
  46. }
  47.  
  48. close(SPOOL);
  49.